package com.marketlive.entity.account;

import com.marketlive.entity.Entity;
import org.apache.commons.logging.Log;

/*
(C) Copyright MarketLive. 2006. All rights reserved.
MarketLive is a trademark of MarketLive, Inc.
Warning: This computer program is protected by copyright law and international treaties.
Unauthorized reproduction or distribution of this program, or any portion of it, may result
in severe civil and criminal penalties, and will be prosecuted to the maximum extent
possible under the law.
*/

import org.apache.commons.logging.LogFactory;
import org.marketlive.entity.IEntityHome;
import org.marketlive.entity.account.IContact;
import org.marketlive.entity.account.IContactHome;
import org.marketlive.entity.account.ICustomer;

import java.util.Date;

/**
 * Represents a personal contact of a customer. Contains the name, address and
 * other miscellaneous communication information, of a particular person.
 * @see IPerson, IAddress, ICustomer, ICustomerHome, IContactHome
 */
public class Contact extends Entity implements IContact {
    /**
     * Logger.
     */
    private static Log log = LogFactory.getLog(Contact.class);
    /**
     * The unique type assigned to this entity.
     */
    public static final String ENTITY_TYPE = "contact";
    /**
     * The Contact Home Object Interface.
     */
    private static IContactHome entityHome;
    /**
     * Reference to the Customer this contact belongs to.
     */
    private ICustomer customer;
    /**
     * Alias of this contact.
     */
    private String alias;
    /**
     * Code for this contact.
     */
    private String code;
    /**
     * Phone1 of this contact.
     */
    private String phone1;
    /**
     * Phone2 of this contact.
     */
    private String phone2;
    /**
     *Phone extension of this contact.
     */
    private String extension;
    /**
     * The fax number of this contact.
     */
    private String fax;
    /**
     * The email address of this contact.
     */
    private String email;
    /**
     * The company of this contact.
     */
    private String company;
    /**
     * Primary status of this contact.
     */
    private boolean primary;
    /**
     * Status of this contact being in the address book. Default is true.
     */
    private boolean inAddressBook = true; //changed to true to fix MLPB-2187.
    /**
     * Deleted status of this contact.
     */
    private boolean deleted;
    /**
     * Date deleted property.
     */
    private Date dateDeleted;

    // Name
    private String name;


    /**
     * Set the Entity Home to the given Home Object. (Typically set through injection.)
     *
     * @param entityHome to set
     */
    public static void setEntityHome(final IContactHome entityHome) {
        Contact.entityHome = entityHome;
    }

    /**
     * @inheritDoc
     */
    public IEntityHome getEntityHome() {
        return entityHome;
    }

    /**
     * Default constructor.
     */
    public Contact() {
        log.debug("called default c'tor");
    }

    /**
     * @inheritDoc
     */
    public ICustomer getCustomer() {
        return this.customer;
    }

    /**
     * @inheritDoc
     */
    public void setCustomer(final ICustomer customer) {
        this.customer = customer;
    }

    /**
     * @inheritDoc
     */
    public String getAlias() {
        return this.alias;
    }

    /**
     * @inheritDoc
     */
    public void setAlias(final String alias) {
        this.alias = alias;
    }

    /**
     * @inheritDoc
     */
    public String getCode() {
        return code;
    }

    /**
     * @inheritDoc
     */
    public void setCode(final String code) {
        this.code = code;
    }

    /**
     * @inheritDoc
     */
    public String getPhone1() {
        return this.phone1;
    }

    /**
     * @inheritDoc
     */
    public void setPhone1(final String phone1) {
        this.phone1 = phone1;
    }

    /**
     * @inheritDoc
     */
    public String getPhone2() {
        return this.phone2;
    }

    /**
     * @inheritDoc
     */
    public void setPhone2(final String phone2) {
        this.phone2 = phone2;
    }

    /**
     * @inheritDoc
     */
    public String getExtension() {
        return this.extension;
    }

    /**
     * @inheritDoc
     */
    public void setExtension(String extension) {
        this.extension = extension;
    }

    /**
     * @inheritDoc
     */
    public String getFax() {
        return this.fax;
    }

    /**
     * @inheritDoc
     */
    public void setFax(final String fax) {
        this.fax = fax;
    }

    /**
     * @inheritDoc
     */
    public String getEmail() {
        return this.email;
    }

    /**
     * @inheritDoc
     */
    public void setEmail(final String email) {
        this.email = email;
    }

    /**
     * @inheritDoc
     */
    public String getCompany() {
        return this.company;
    }

    /**
     * @inheritDoc
     */
    public void setCompany(final String company) {
        this.company = company;
    }

    /**
     * @inheritDoc
     */
    public boolean isPrimary() {
        return this.primary;
    }

    /**
     * @inheritDoc
     */
    public void setPrimary(final boolean primary) {
        this.primary = primary;
    }

    /**
     * @inheritDoc
     */
    public boolean isInAddressBook() {
        return this.inAddressBook;
    }

    /**
     * @inheritDoc
     */
    public void setInAddressBook(final boolean inAddressBook) {
        this.inAddressBook = inAddressBook;
    }

    /**
     * @inheritDoc
     */
    public boolean isDeleted() {
        return this.deleted;
    }

    /**
     * @inheritDoc
     */
    public void setDeleted(final boolean deleted) {
        this.deleted = deleted;
    }

    /**
     * @inheritDoc
     */
    public Date getDateDeleted() {
        return this.dateDeleted;
    }

    /**
     * @inheritDoc
     */
    public void setDateDeleted(final Date dateDeleted) {
        this.dateDeleted = dateDeleted;
    }

    /**
     * {@inheritDoc}
     */

    public String getName() {
        return name;
    }

    /**
     * {@inheritDoc}
     */

    public void setName(final String name) {
        this.name = name;
    }
}
